Overview Keywords can be subdivided into functions, which return a value, and commands, which do not. In practice you use functions and commands together, often using functions as if they were commands, ignoring the values they return. This chapter lists all the keywords, grouped according to their purpose. Use this chapter if you know what you'd like to do, but not which function or command will do it. The chapter which follows this one lists the keywords alphabetically, with explanations and full specifications. Program control *** Loops, branches, jumps Repeat a set of instructions {DO...UNTIL WHILE...ENDW Do either one set of instructions or another set, or another, or another... IF...ENDIF Go... ...to a specified label GOTO ...to one of a list of labels VECTOR/ENDV ...to the end/start of a repeating set of instructions BREAK, CONTINUE ...back to the calling procedure RETURN End the program STOP *** Error handling Raise an error RAISE Put an explanatory comment in your program REM Declare an error-handler ONERR Let the program continue after an error TRAP After an error, find out what the error was ERR, ERR$ Screen and keyboard control Display a string to be edited and get a value from the keyboard EDIT Get a value from the keyboard INPUT Display text, numbers etc. PRINT Set screen update method gUPDATE Pause... ...for a number of seconds PAUSE ...until a key is pressed GET, GET$ Position or hide the cursor AT, CURSOR Clear the text window CLS Sound the buzzer BEEP Set the size/position of the text window SCREEN Get information on the text window SCREENINFO Set text window font and style FONT, STYLE Find out which key was pressed, if any KEY, KEY$, GET, GET$ Find out what combination of modifiers was pressed KMOD Disable/enable stopping from a running program ESCAPE Off/On Turn the Series 3a off OFF Files *** General file management Copy a file COPY Delete or rename a file DELETE, RENAME Check to see if a certain file exists EXIST Find out what files there are DIR$ *** OPL procedures and modules Set up a procedure cache CACHE Load an OPL module file so you can use the procedures in it LOADM Remove a module from memory UNLOADM *** Data files Create a new data file CREATE OPEN or CLOSE a data file OPEN, OPENR, CLOSE Use a different data file that has been opened USE Copy a data file, optionally appending to another data file, and removing deleted records COMPRESS Once a data file has been OPENed, you can: Make a new record APPEND Change a record UPDATE Search for those records which contain a certain string FIND, FINDFIELD Erase a record ERASE Move to a different record {FIRST, LAST, NEXT, BACK, POSITION Count the records COUNT Find whether you're at the end of the file yet EOF Find the current record number POS Find the number of bytes used by the current record RECSIZE *** Managing directories Create directory MKDIR Set current directory SETPATH Remove directory RMDIR Memory Declare variables GLOBAL, LOCAL Find how much free memory there is on a device SPACE Printing Specify a device or file to print to LOPEN Close the print device or file opened with LOPEN LCLOSE Print to a device or file LPRINT Numbers *** Trigonometry Trig functions {COS, SIN, TAN, ACOS, ASIN, ATAN Convert between degrees and radians RAD, DEG *** Other functions Raise e to a power EXP Logarithms LN, LOG Pi as a constant PI Square root SQR Use random numbers RND, RANDOMIZE Unsigned integer/pointer arithmetic UADD, USUB *** Lists of numbers Find the greatest or smallest value in the list MAX, MIN Average the list MEAN Add up the list SUM Find the standard deviation or variance STD, VAR *** Changing the format of numbers Knock the minus sign off a number ABS, IABS Take whole number, removing any fractional part INT, INTF Convert... ...an integer into floating-point FLT ...an integer into a hexadecimal string HEX$ ...a number into a string {FIX$, GEN$ SCI$, NUM$ ...a string into a number EVAL, VAL Strings Copy characters from a string LEFT$, MID$, RIGHT$ Repeat a string REPT$ Make a string upper or lower case LOWER$, UPPER$ Find out... ...how long a string is LEN ...the character code of the first character of a string ASC ...where a certain string is within a string LOC Convert... ... a string of digits to a number VAL ...a number to a string {FIX$, GEN$ SCI$, NUM$ Get the character with a certain character code CHR$ Date and time Find out the current date and time... ...as a string DATIM$ ...just the current time {SECOND, MINUTE, HOUR ...just the current date DAY, MONTH, YEAR Find out... ...the number of days between two dates DAYS ...what day of the week, or what week number, a certain date falls in DOW, WEEK Express... ...1-12 as the name of a month MONTH$ ...1-7 as a day of the week DAYNAME$ Convert between time formats {DATETOSECS SECSTODATE Graphics *** Drawing commands Set current position gAT, gMOVE Draw a line gLINEBY, gLINETO Draw a sequence of lines gPOLY Draw a rectangle {gBOX, gBORDER gXBORDER Fill a rectangle gFILL Invert a rectangle gINVERT Scroll a rectangle gSCROLL Get current position gX, gY Display a running clock gCLOCK Draw a 3-D button (key) gBUTTON Draw a lozenge gDRAWOBJECT *** Displaying graphics text Display a list of expressions gPRINT Display text in a cleared box gPRINTB Display text neatly clipped gPRINTCLIP Find width required by text gTWIDTH Display text underlined/highlighted gXPRINT *** Setting styles Set font to use gFONT Set to user-defined fonts {gLOADFONT gUNLOADFONT Set graphics to set / clear / invert points gGMODE Set text to set / clear / invert / replace points gTMODE Set text to bold / underline / inverse / double / mono / italic gSTYLE *** Windows and bitmaps Create a new window gCREATE Set position and/or size of a window gSETWIN Set order to show windows gORDER Get order of a window gRANK Set window visible / invisible gVISIBLE Get screen position of a window {gORIGINX gORIGINY Create a bitmap gCREATEBIT Load a bitmap from file gLOADBIT Clear a window / bitmap gCLS Save window / bitmap to bitmap file gSAVEBIT Close down a window / bitmap gCLOSE Set which window / bitmap to use gUSE Set grey on/off in a window {gGREY DEFAULTWIN Fill an area with repetitions of another window / bitmap gPATT Copy an area from one window / bitmap to another gCOPY Read data back from a window / bitmap gPEEKLINE Get ID number of a window / bitmap gIDENTITY Get size of a window / bitmap gWIDTH, gHEIGHT Get status information about a window / bitmap and about the cursor gINFO *** Sprites Create a sprite CREATESPRITE Define bitmap-sets for a sprite {APPENDSPRITE CHANGESPRITE Draw a sprite DRAWSPRITE Set a sprite's position POSSPRITE Set which sprite to use USESPRITE Close a sprite CLOSESPRITE Menus Start a new set of menus mINIT Define a menu mCARD Display menus MENU Dialogs Start a new dialog dINIT Position a dialog dPOSITION Define text for a dialog dTEXT Define an edit box for a dialog dEDIT Define a secret edit box for a dialog dXINPUT Define a filename edit box for a dialog dFILE Define a choice list for a dialog dCHOICE Define a numeric edit box for a dialog dFLOAT, dLONG Define a date/time edit box for a dialog dDATE, dTIME Define exit keys for a dialog dBUTTONS Display a dialog DIALOG Display a simple "alert" dialog ALERT Status Window Display/hide status window STATUSWIN Get status window information STATWININFO Set a program's name SETNAME Initialise a DIAMOND list DIAMINIT Position DIAMOND on a DIAMOND list DIAMPOS Screen messages Display information messages GIPRINT Display `busy' messages BUSY Advanced use Run machine code USR, USR$ Find out where a certain variable is in memory ADDR Store a value in a specific place in memory POKE commands Find out the value stored at a certain place in memory PEEK commands Open any type of file IOOPEN Read from a file opened with IOOPEN IOREAD Write to a file opened with IOOPEN IOWRITE Close a file opened with IOOPEN IOCLOSE Position within a file opened with IOOPEN IOSEEK Keywords which provide low-level access to the Series 3a Call an operating system service CALL, OS Perform an aysnchronous I/O function IOA, IOC Cancel an aysnchronous I/O function IOCANCEL Wait for completion of a function performed by IOA or IOC {IOWAIT IOWAITSTAT Signal completion of an I/O function IOSIGNAL Ensure an asynchronous handler runs IOYIELD Perform a synchronous I/O function IOW Perfom an asynchronous keyboard read KEYA Cancel a KEYA KEYC Get command line information CMD$, GETCMD$ Parse a full file specification PARSE$ Check for system events {GETEVENT TESTEVENT Mark an OPA as locked or unlocked LOCK Get system-level info on data files ODBINFO Load/link a DYL LOADLIB, LINKLIB Unload a DYL UNLOADLIB Find category handles FINDLIB, GETLIBH Create new objects NEWOBJ, NEWOBJH Send a message to an object {SEND, ENTERSEND ENTERSEND0 Allocate a heap cell ALLOC Free an allocated cell FREEALLOC Change size of allocated cell REALLOC Insert or delete section of cell ADJUSTALLOC Find length of allocated cell LENALLOC Remove returned procedures from a cache CACHETIDY Read cache index header CACHEHDR Read cache index record CACHEREC